home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Languages / MPW Oberon 2.1168 / OInterfaces / Types.mod < prev    next >
Encoding:
Text File  |  1995-08-10  |  7.3 KB  |  329 lines  |  [TEXT/MPS ]

  1. (*
  2.      File:        Types.mod
  3.  
  4.      Contains:    Basic Macintosh data types.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Package:    Universal Interfaces 2.0 in “MPW Latest” on ETO #17
  8.  
  9.      Copyright:    © 1984-1995 by Apple Computer, Inc.
  10.                  All rights reserved.
  11.  
  12.      Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13.                  stack.  Include the file and version information (from above)
  14.                  in the problem description and send to:
  15.                      Internet:    apple.bugs.applelink.apple.com
  16.                      AppleLink:    APPLE.BUGS
  17.  
  18. *)
  19.  
  20. (*$TAGS-*)
  21. (*$CALLING PASCAL*)
  22. MODULE Types;
  23.  
  24. IMPORT SYSTEM;
  25. (*ΔΔ (* $IFC UNDEFINED __CONDITIONALMACROS__*)
  26. (* $I ConditionalMacros.p*)
  27. (* $ENDC*)
  28.  
  29. (* $PUSH*)
  30. (* $ALIGN MAC68K*)
  31. (* $LibExport+*)*)
  32.  
  33. CONST
  34.     noErr*                        = 0;
  35.  
  36.     
  37. TYPE
  38.     Byte* = SYSTEM.BYTE (*ΔΔ 0..255*);
  39.  
  40.     SignedByte* = SHORTINT (*ΔΔ -128..127*);
  41.  
  42.     UInt8* = Byte;
  43.  
  44.     SInt8* = SignedByte;
  45.  
  46.     UInt16* = INTEGER;
  47.  
  48.     SInt16* = INTEGER;
  49.  
  50.     UInt32* = LONGINT;
  51.  
  52.     SInt32* = LONGINT;
  53.  
  54.     UniChar* = UInt16;
  55.  
  56.     ByteParameter* = SignedByte;
  57.  
  58. Data* = RECORD END;
  59.     Ptr* = POINTER TO Data(*ΔΔ SignedByte*);
  60.  
  61. (*  pointer to a master pointer *)
  62.     Handle* = HANDLE TO Data (*ΔΔ POINTER TO Ptr*);
  63.  
  64. (*ΔΔ $IFC UNDEFINED qMacApp *)
  65. (*$IF FALSE AND UNDEFINED qMacApp *)
  66.     IntegerPtr* = POINTER TO INTEGER;
  67.  
  68.     LongIntPtr* = POINTER TO LONGINT;
  69.  
  70. (*$END*)
  71.     Fixed* = LONGINT;
  72.  
  73.     (*ΔΔ FixedPtr* = POINTER TO Fixed;*)
  74.  
  75.     Fract* = LONGINT;
  76.  
  77.     (*ΔΔ FractPtr* = POINTER TO Fract;*)
  78.  
  79.     _extended80* = RECORD
  80.         exp*:                    INTEGER;
  81.         man*:                    ARRAY 4 (*ΔΔ[0..3]ΔΔ*) OF INTEGER;
  82.     END;
  83.  
  84.     _extended96* = RECORD
  85.         exp*:                    ARRAY 2 (*ΔΔ[0..1]ΔΔ*) OF INTEGER;
  86.         man*:                    ARRAY 4 (*ΔΔ[0..3]ΔΔ*) OF INTEGER;
  87.     END;
  88.  
  89. (*$IF GENERATING68K *)
  90. (* 
  91. Note: on PowerPC extended is undefined.
  92.       on 68K when mc68881 is on, extended is 96 bits.  
  93.              when mc68881 is off, extended is 80 bits.  
  94.       Some old toolbox routines require an 80 bit extended so we define extended80
  95. *)
  96. (*$IF GENERATING68881 *)
  97.     Extended80* = _extended80;
  98.  
  99.     Extended96* = Extended;
  100.  
  101. (*$ELSE*)
  102.     Extended80* = LONGREAL (*ΔΔ Extended*);
  103.  
  104.     Extended96* = _extended96;
  105.  
  106. (*$END*)
  107. (*$ELSE*)
  108.     Extended80* = _extended80;
  109.  
  110.     Extended96* = _extended96;
  111.  
  112. (*$END*)
  113. (*
  114. Note: float_t and double_t are "natural" computational types
  115.       (i.e.the compiler/processor can most easily do floating point
  116.       operations with that type.) 
  117. *)
  118. (*$IF GENERATINGPOWERPC *)
  119. (* on PowerPC, double* = 64-bit which is fastest.  float* = 32-bit *)
  120.     float_t* = Single;
  121.  
  122.     double_t* = Double;
  123.  
  124. (*$IF LSPWRP *)
  125.     LongDouble* = RECORD
  126.         head*:                    Double;
  127.         tail*:                    Double;
  128.     END;
  129.  
  130. (*$END*)
  131. (*$ELSE*)
  132. (* on 68K, long double (a.k.a. extended) is always the fastest.  It is 80 or 96-bits *)
  133.     float_t* = LONGREAL (*ΔΔ extended*);
  134.  
  135.     double_t* = LONGREAL (*ΔΔ extended*);
  136.  
  137. (*$END*)
  138.     wide* = RECORD
  139.         hi*:                        SInt32;
  140.         lo*:                        UInt32;
  141.     END;
  142.  
  143.     WidePtr* = POINTER TO wide;
  144.  
  145.     UnsignedWide* = RECORD
  146.         hi*:                        UInt32;
  147.         lo*:                        UInt32;
  148.     END;
  149.  
  150.     UnsignedWidePtr* = POINTER TO UnsignedWide;
  151.  
  152.  
  153. CONST
  154.     v*                            = 0;
  155.     h*                            = 1;
  156.  
  157.     
  158. TYPE
  159.     VHSelect* = SInt8;
  160.  
  161.     ProcPtr* = PROCEDURE (*ΔΔ Ptr*);
  162.  
  163.     Register68kProcPtr* = PROCEDURE (*ΔΔ ProcPtr*);
  164.  
  165.     ProcHandle* = SYSTEM.HANDLE (*ΔΔ POINTER TO ProcPtr*);
  166.  
  167.     UniversalProcPtr* = ProcPtr;
  168.     UniversalProcHandle* = SYSTEM.HANDLE (*ΔΔ POINTER TO ProcPtr*);
  169.  
  170.     Str255* = ARRAY 256 OF CHAR (*ΔΔ STRING[255]*);
  171.     Str63* = ARRAY 64 OF CHAR (*ΔΔ STRING[63]*);
  172.     Str32* = ARRAY 33 OF CHAR (*ΔΔ STRING[32]*);
  173.     Str31* = ARRAY 32 OF CHAR (*ΔΔ STRING[31]*);
  174.     Str27* = ARRAY 28 OF CHAR (*ΔΔ STRING[27]*);
  175.     Str15* = ARRAY 16 OF CHAR (*ΔΔ STRING[15]*);
  176.  
  177.     StringPtr* = POINTER TO Str255;
  178.     StringHandle* = HANDLE TO Str255 (*ΔΔ POINTER TO StringPtr*);
  179.  
  180. (* A C string is a zero terminated array of bytes.  There is no length byte.
  181.     a CStringPtr is a pointer to a C string (e.g. char* )
  182.     a ConstCStringPtr is a CStringPtr whose contents cannot be changed (e.g. const char* )
  183. *)
  184.     CStringPtr* = Ptr;
  185.     ConstCStringPtr* = Ptr;
  186.  
  187.     ConstStr255Param* = Str255;
  188.  
  189.     ConstStr63Param* = Str63;
  190.  
  191.     ConstStr32Param* = Str32;
  192.  
  193.     ConstStr31Param* = Str31;
  194.  
  195.     ConstStr27Param* = Str27;
  196.  
  197.     ConstStr15Param* = Str15;
  198.  
  199.     OSErr* = INTEGER;
  200.  
  201.     ScriptCode* = INTEGER;
  202.  
  203.     LangCode* = INTEGER;
  204.  
  205. (*$IF GENERATING68K OR UNDEFINED MWERKS *)
  206.     FourCharCode* =  LONGINT (*ΔΔ PACKED ARRAY [1..4] OF CHAR*);
  207. (*$ELSE*)
  208.     FourCharCode* =  UNSIGNEDLONG;
  209. (*$END*)
  210.     (*ΔΔ StyleItem* = (bold,italic,underline,outline,shadow,condense,extend);*)
  211.     SytleItem* = SHORTINT;
  212. CONST
  213.     bold* = 1; italic* = 2; underline* = 4; outline* = 8; shadow* = 16; condense* = 32; extend* = 64;
  214. TYPE
  215.     Style* = SHORTINT (*ΔΔ SET OF StyleItem*);
  216.  
  217.     OSType* = FourCharCode;
  218.  
  219.     ResType* = FourCharCode;
  220.  
  221.     (*ΔΔ OSTypePtr* = POINTER TO OSType;
  222.  
  223.     ResTypePtr* = POINTER TO ResType;*)
  224.  
  225.     Point* = RECORD
  226.         (*ΔΔ CASE INTEGER OF
  227.         0: ( *)
  228.             v*:                            INTEGER;
  229.             h*:                            INTEGER;
  230.            (*ΔΔ);
  231.         1: (
  232.             vh*:                            ARRAY [0..1] OF INTEGER;
  233.            );*)
  234.     END;
  235.  
  236.     PointPtr* = POINTER TO Point;
  237.  
  238.     Rect* = RECORD
  239.         (*ΔΔ CASE INTEGER OF
  240.         0: ( *)
  241.             top*:                        INTEGER;
  242.             left*:                        INTEGER;
  243.             bottom*:                        INTEGER;
  244.             right*:                        INTEGER;
  245.            (*);
  246.         1: (
  247.             topLeft*:                    Point;
  248.             botRight*:                    Point;
  249.            );*)
  250.     END;
  251.  
  252.     RectPtr* = POINTER TO Rect;
  253.  
  254. (* Numeric version part of LONG("vers") resource *)
  255.     NumVersion* = (*ΔΔ PACKED*) RECORD
  256.         majorRev*:                UInt8;                                    (*1st part of version number in BCD*)
  257.         minorAndBugRev*:            UInt8;                                    (*2nd & 3rd part of version number share a byte*)
  258.         stage*:                    UInt8;                                    (*stage code: dev, alpha, beta, final*)
  259.         nonRelRev*:                UInt8;                                    (*revision level of non-released version*)
  260.     END;
  261.  
  262. (* LONG("vers") resource format *)
  263.     VersRec* = RECORD
  264.         numericVersion*:            NumVersion;                                (*encoded version number*)
  265.         countryCode*:            INTEGER;                                (*country code from intl utilities*)
  266.         shortVersion*:            Str255;                                    (*version number string - worst case*)
  267.         reserved*:                Str255;                                    (*longMessage string packed after shortVersion*)
  268.     END;
  269.  
  270.     VersRecPtr* = POINTER TO VersRec;
  271.     VersRecHndl* = HANDLE TO VersRec (*ΔΔ POINTER TO VersRecPtr*);
  272.  
  273.     KernelID* = Ptr;
  274.  
  275.     OSStatus* = SInt32;
  276.  
  277.     LogicalAddress* = Ptr;
  278.  
  279. (*
  280.     Who implements what debugger functions:
  281.     
  282.     Name            MacsBug                SADE        Macintosh Debugger
  283.     ----------        -----------            -------        -----------------------------
  284.     Debugger        yes                    no            InterfaceLib maps to DebugStr
  285.     DebugStr        yes                    no            yes
  286.     Debugger68k        yes                    no            InterfaceLib maps to DebugStr
  287.     DebugStr68k        yes                    no            InterfaceLib maps to DebugStr
  288.     debugstr        yes                    no            InterfaceLib maps to DebugStr
  289.     SysBreak        no, for SADE        yes            InterfaceLib maps to SysError
  290.     SysBreakStr        no, for SADE        yes            InterfaceLib maps to SysError
  291.     SysBreakFunc    no, for SADE        yes            InterfaceLib maps to SysError
  292.  
  293. *)
  294.  
  295. PROCEDURE Debugger*;
  296.     (*$IF NOT GENERATINGCFM*)
  297.     INLINE PASCAL $A9FF;
  298.     (*$END*)
  299. PROCEDURE DebugStr*(debuggerMsg: ConstStr255Param);
  300.     (*$IF NOT GENERATINGCFM*)
  301.     INLINE PASCAL $ABFF;
  302.     (*$END*)
  303. PROCEDURE Debugger68k*;
  304.     (*$IF NOT GENERATINGCFM*)
  305.     INLINE PASCAL $A9FF;
  306.     (*$END*)
  307. PROCEDURE DebugStr68k*(debuggerMsg: ConstStr255Param);
  308.     (*$IF NOT GENERATINGCFM*)
  309.     INLINE PASCAL $ABFF;
  310.     (*$END*)
  311. PROCEDURE SysBreak*;
  312.     (*$IF NOT GENERATINGCFM*)
  313.     INLINE PASCAL $303C, $FE16, $A9C9;
  314.     (*$END*)
  315. PROCEDURE SysBreakStr*(debuggerMsg: ConstStr255Param);
  316.     (*$IF NOT GENERATINGCFM*)
  317.     INLINE PASCAL $303C, $FE15, $A9C9;
  318.     (*$END*)
  319. PROCEDURE SysBreakFunc*(debuggerMsg: ConstStr255Param);
  320.     (*$IF NOT GENERATINGCFM*)
  321.     INLINE PASCAL $303C, $FE14, $A9C9;
  322.     (*$END*)
  323.  
  324. (*ΔΔ (* $ALIGN RESET*)
  325. (* $POP*)
  326.  
  327. (* $SETC UsingIncludes := TypesIncludes*)*)
  328.  
  329.  END Types.